Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@trendmicro/react-dropdown
Advanced tools
React Dropdown
Demo: https://trendmicro-frontend.github.io/react-dropdown
npm install --save react @trendmicro/react-dropdown
@trendmicro/react-dropdown
and its styles in your application as follows:import Dropdown, {
DropdownToggle,
DropdownMenu,
DropdownSubMenu,
MenuItem,
DropdownButton
} from '@trendmicro/react-dropdown';
// Be sure to include styles at some point, probably during your bootstraping
import '@trendmicro/react-buttons/dist/react-buttons.css';
import '@trendmicro/react-dropdown/dist/react-dropdown.css';
Create a common components directory including both Buttons
and Dropdown
components, as shown below:
components/
Buttons/
index.js
Dropdown/
index.js
components/Buttons/index.js
import '@trendmicro/react-buttons/dist/react-buttons.css';
export { Button, ButtonGroup, ButtonToolbar } from '@trendmicro/react-buttons';
components/Dropdown/index.js
import '@trendmicro/react-dropdown/dist/react-dropdown.css';
import Dropdown from '@trendmicro/react-dropdown';
import '../Buttons'; // Ensure CSS dependency
export default Dropdown;
export {
DropdownToggle,
DropdownMenu,
DropdownSubMenu,
MenuItem,
DropdownButton
} from '@trendmicro/react-dropdown';
Then, import Dropdown
component in your code:
import Dropdown from './components/Dropdown';
<Dropdown
onSelect={(eventKey) => {
}}
>
<Dropdown.Toggle
btnStyle="flat"
>
Toggler
</Dropdown.Toggle>
<Dropdown.Menu>
<MenuItem header>Header</MenuItem>
<MenuItem eventKey={1}>link</MenuItem>
<MenuItem divider />
<MenuItem header>Header</MenuItem>
<MenuItem eventKey={2}>link</MenuItem>
<MenuItem eventKey={3} disabled>disabled</MenuItem>
<MenuItem
eventKey={4}
title="link with title"
>
link with title
</MenuItem>
<MenuItem
eventKey={5}
href="#someHref"
active
onSelect={(eventKey) => {
alert(`Alert from menu item.\neventKey: ${eventKey}`);
}}
>
link that alerts
</MenuItem>
</Dropdown.Menu>
</Dropdown>
<Dropdown>
<Dropdown.Toggle title="Select an option" />
<Dropdown.Menu>
<MenuItem>
Menu item one
</MenuItem>
<MenuItem>
Menu item two
</MenuItem>
<MenuItem>
Menu item three
</MenuItem>
<MenuItem divider />
<Dropdown.SubMenu title="Menu item four">
<MenuItem>
Second level item one
</MenuItem>
<MenuItem>
Second level item two
</MenuItem>
<Dropdown.SubMenu title="Second level item three">
<MenuItem>
Third level item one
</MenuItem>
</Dropdown.SubMenu>
</Dropdown.SubMenu>
</Dropdown.Menu>
</Dropdown>
<DropdownButton
btnSize="xs"
title="More"
onSelect={(eventKey) => {
}}
>
<MenuItem eventKey={1}>link</MenuItem>
<MenuItem eventKey={2}>link</MenuItem>
</DropdownButton>
Name | Type | Default | Description |
---|---|---|---|
componentClass | element | ButtonGroup | A custom element for this component. |
dropup | boolean | false | The menu will open above the dropdown button, instead of below it. |
disabled | boolean | false | Whether or not component is disabled. |
open | boolean | false | Whether or not the dropdown is visible. |
autoOpen | boolean | false | Whether to open the dropdown on mouse over. |
pullRight | boolean | false | Align the menu to the right side of the dropdown toggle. |
onClose | function(event) | A callback fired when the dropdown closes. | |
onToggle | function(boolean) | A callback fired when the dropdown wishes to change visibility. Called with the requested open value. | |
onSelect | function(eventKey, event) | A callback fired when a menu item is selected. | |
role | string | If 'menuitem' , causes the dropdown to behave like a menu item rather than a menu button. | |
rootCloseEvent | One of: 'click' 'mousedown' | Which event when fired outside the component will cause it to be closed. |
Name | Type | Default | Description |
---|---|---|---|
componentClass | element | Button | A custom element for this component. |
btnSize | One of: 'lg' 'md' 'sm' 'xs' | 'md' | |
btnStyle | One of: 'default' 'primary' 'emphasis' 'flat' 'link' | 'flat' | |
noCaret | boolean | false | Whether to prevent a caret from being rendered next to the title. |
title | node | Title content. | |
disabled | boolean | false | Whether or not component is disabled. |
open | boolean | false | Whether or not the dropdown is visible. |
Name | Type | Default | Description |
---|---|---|---|
componentClass | element | ul | A custom element for this component. |
scrollable | boolean | false | Whether or not the scrollbar is visible. |
maxHeight | number | 150 | The maximum height of the dropdown menu. |
open | boolean | false | Whether or not the dropdown is visible. |
pullRight | boolean | false | Align the menu to the right side of the dropdown toggle. |
onClose | function(event) | A callback fired when the dropdown menu closes. | |
onSelect | function(eventKey, event) | A callback fired when a menu item is selected. | |
rootCloseEvent | One of: 'click' 'mousedown' | Which event when fired outside the component will cause it to be closed. |
Name | Type | Default | Description |
---|---|---|---|
active | boolean | false | Highlight the menu item as active. |
disabled | boolean | false | Disable the menu item, making it unselectable. |
eventKey | any | Value passed to the onSelect handler, useful for identifying the selected menu item. | |
open | boolean | false | Whether or not the dropdown submenu is visible. |
title | node | Title content. | |
href | string | HTML href attribute corresponding to a.href . | |
onClick | function(event) | Callback fired when the menu item is clicked. | |
onSelect | function(eventKey, event) | Callback fired when the menu item is selected. |
Name | Type | Default | Description |
---|---|---|---|
active | boolean | false | Highlight the menu item as active. |
disabled | boolean | false | Disable the menu item, making it unselectable. |
divider | boolean | false | Style the menu item as a horizontal rule, providing visual separation between groups of menu items. |
eventKey | any | Value passed to the onSelect handler, useful for identifying the selected menu item. | |
header | boolean | false | Style the menu item as a header label, useful for describing a group of menu items. |
href | string | HTML href attribute corresponding to a.href . | |
onClick | function(event) | Callback fired when the menu item is clicked. | |
onSelect | function(eventKey, event) | Callback fired when the menu item is selected. |
Name | Type | Default | Description |
---|---|---|---|
componentClass | element | ButtonGroup | A custom element for this component. |
dropup | boolean | false | The menu will open above the dropdown button, instead of below it. |
disabled | boolean | false | Whether or not component is disabled. |
pullRight | boolean | false | Align the menu to the right side of the dropdown toggle. |
open | boolean | false | Whether or not the dropdown is visible. |
onClose | function(event) | A callback fired when the dropdown closes. | |
onToggle | function(boolean) | A callback fired when the dropdown wishes to change visibility. Called with the requested open value. | |
onSelect | function(eventKey, event) | A callback fired when a menu item is selected. | |
role | string | If 'menuitem' , causes the dropdown to behave like a menu item rather than a menu button. | |
rootCloseEvent | One of: 'click' 'mousedown' | Which event when fired outside the component will cause it to be closed. | |
btnSize | One of: 'lg' 'md' 'sm' 'xs' | 'md' | |
btnStyle | One of: 'default' 'primary' 'emphasis' 'flat' 'link' | 'flat' | |
title | node | Title content. | |
noCaret | boolean | false | Whether to prevent a caret from being rendered next to the title. |
MIT
FAQs
React Dropdown component
We found that @trendmicro/react-dropdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.